home *** CD-ROM | disk | FTP | other *** search
- Sub change_chars (ByVal from$, ByVal new$, dest$)
- pos = InStr(dest$, from$)
- While pos <> 0
- Mid$(dest$, pos) = new$
- pos = InStr(dest$, from$)
- Wend
- End Sub
-
- Sub extract_param (ByVal filename$, ByVal param$, dest$)
- dest$ = ""
- fileno = fopen(filename$, "r")
- While Not EOF(fileno) And Len(dest$) = 0
- Input #fileno, text_line$
- If Left$(text_line$, Len(param$)) = param$ Then
- dest$ = Mid$(text_line$, InStr(text_line$, ":") + 1)
- While Left$(dest$, 1) = " "
- dest$ = Mid$(dest$, 2)
- Wend
- End If
- Wend
- Close #fileno
- End Sub
-
- Function fopen (ByVal fname$, ByVal mode$) As Integer
- fileno% = FreeFile
- On Error Resume Next
- Select Case mode$
- Case "r": Open fname$ For Input As #fileno%
- Case "rb": Open fname$ For Binary Access Read As #fileno%
- Case "w": Open fname$ For Output As #fileno%
- Case "a": Open fname$ For Append As #fileno%
- Case Else
- MsgBox "Invalid fopen() mode: " + mode$
- Stop
- End Select
- If Err = 0 Then
- fopen = fileno%
- Else
- fopen = 0
- MsgBox fname$ + ": " + Error$, 16, "File Open Error"
- End
- End If
- End Function
-
- Function get_filename (ByVal direct As String) As String
- file_select.visible = True
- file_select.enabled = True
- file_select.SetFocus
- file_select.sel_dir.path = direct
- edit.enabled = false
- While file_select.visible
- dummy% = DoEvents()
- Wend
- edit.enabled = true
- edit.SetFocus
-
- get_filename$ = file_select.sel_filename.Text
- End Function
-
- Sub get_header (dest$, subject$, sig%, ByVal mail)
- If subject$ <> "" Then
- header_form.subject.Text = "Re: " + subject$
- Else
- header_form.subject.Text = ""
- End If
- header_form.sig_check.value = sig%
- header_form.dest.Text = dest$
- If mail Then
- header_form.dest_caption.Text = "To:"
- Else
- header_form.dest_caption.Text = "Newsgroups:"
- End If
-
- header_form.visible = True
- header_form.enabled = True
- header_form.SetFocus
- edit.enabled = false
- While header_form.visible
- dummy% = DoEvents()
- Wend
- edit.enabled = true
- edit.SetFocus
- dest$ = header_form.dest.Text
- subject$ = header_form.subject.Text
- sig% = header_form.sig_check.value
- End Sub
-
- Function get_mail (ByVal ind%) As String
- dest$ = ""
- fileno = fopen(mail_file$ + ".i", "rb")
- i% = -1
- dummy$ = String$(28, 0)
- While i% < ind% And Not EOF(fileno)
- Get #fileno, , offset&
- Get #fileno, , length&
- Get #fileno, , dummy$
- i% = i% + 1
- Wend
- Close #fileno
- If i% = ind% Then
- fileno = fopen(mail_file$ + ".f", "rb")
- Seek #fileno, offset& + 1
- dest$ = String$(length&, 0)
- Get #fileno, , dest$
- Close #fileno
- End If
- get_mail = dest$
- End Function
-
- Function load_file (ByVal filename$) As String
- fileno% = fopen(filename$, "rb")
- If LOF(fileno%) > 16000 Then
- dest$ = Input$(16000, #fileno%)
- pos = InStr(dest$, new_line + new_line)
- load_file = Left$(dest$, pos + 3) + "**** Truncated ****" + new_line + new_line + Mid$(dest$, pos + 4)
- Beep
- Else
- load_file = Input$(LOF(fileno%), #fileno%)
- End If
- Close #fileno%
- End Function
-
- Sub make_dir (ByVal source$, dest$)
- dest$ = ""
- pos = InStr(source$, ".")
- While pos <> 0
- If pos <= 8 Then
- dest$ = dest$ + Left$(source$, pos - 1) + "\"
- Else
- dest$ = dest$ + Left$(source$, 8) + "\"
- End If
- source$ = Mid$(source$, pos + 1)
- pos = InStr(source$, ".")
- Wend
- dest$ = news_dir$ + dest$ + Left$(source$, 8) + "\"
- End Sub
-
- Function read_ini (ByVal key$) As String
- result$ = Space$(128)
-
- valid% = getprivateprofilestring("WRN", key$, "", result$, Len(result$), ".\WRN.INI")
- If valid% = 0 Then
- MsgBox key$ + " .INI parameter missing", 16, "Error in .INI file"
- End
- End If
- read_ini = Left$(result$, valid%)
- End Function
-
- Sub word_wrap (Text As String, ByVal length As Integer)
- startpos = 0
- pos = InStr(startpos + 1, Text, Chr$(13))
- While pos <> 0
- linelen = pos - startpos
- If linelen > length Then
- pos = startpos + length
- Do
- If InStr(" .,:;-?!", Mid$(Text, pos, 1)) <> 0 Then
- Exit Do
- End If
- pos = pos - 1
- Loop While pos > startpos
- End If
- If startpos = pos Then
- pos = startpos + length
- End If
- If Asc(Mid$(Text, pos)) <> 13 Then
- Text = Left$(Text, pos) + new_line + Mid$(Text, pos + 1)
- End If
- startpos = pos + 3
- pos = InStr(startpos + 1, Text, Chr$(13))
- Wend
-
- End Sub
-
-